home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr10 / tseacc11.zip / TSEACC11.S < prev    next >
Text File  |  1993-06-12  |  5KB  |  150 lines

  1. /**************** Foreign-Character Macros **************************
  2.  
  3.   For TSE (The Semware Editor), pre-release version 1.0
  4.  
  5.   Author:  David Mayerovitch
  6.            macro version 1.0 07 June 1993
  7.            macro version 1.1 12 June 1993
  8.            - added Spanish, more French characters
  9.            - removed International
  10.  
  11.   This pair of macros provides a quick and convenient way of entering
  12.   foreign-language and other special characters.
  13.  
  14.   mSelectLanguage() presents a menu of languages or other
  15.   special-character sets for the user to choose from. I have assigned
  16.   this macro to <Alt `>.
  17.  
  18.   mAccenter() enables the entry of the special characters belonging to
  19.   the selected set.  I have assigned this macro to the key <`>. Call
  20.   this the trigger key.
  21.  
  22.   These macros do what you do when writing foreign characters by hand:
  23.   first write the basic letterform, then add the diacritical mark.
  24.   Example: If the selected language is French and you want to enter
  25.   the character <é> (e with accent aigu): type the basic character
  26.   <e>, then press the trigger key.  A pop-up menu appears:
  27.  
  28.   ┌──────────┐
  29.   │ Aigu   é │
  30.   │ Grave  è │
  31.   │ Circ   ê │
  32.   │ Umlaut ë │
  33.   └──────────┘
  34.  
  35.   The hotkeys A, G, C, and U generate the four possible e-based
  36.   accented characters in French. Press <A> and the <e> just
  37.   typed will be replaced with <é>.
  38.  
  39.   When there is only one possible accented version of the character
  40.   just typed (e.g. ü in German), the macro automatically inserts it
  41.   without popping up a menu.
  42.  
  43.   The macros as presented here offer the following character sets:
  44.   French: à â ç Ç é è ê ë É î ï ô ù û
  45.   German: ä Ä ö ü Ü
  46.   Spanish: á é í ó ú ñ Ñ ¿ ¡
  47.   Currency: c/C --> ¢ (cents)  l/L --> £ (pounds)  y/Y --> ¥ (yen)
  48.  
  49.   French is the default: it is automatically selected when the macro
  50.   is loaded.  Change the default by changing the global variable
  51.   Language (see macro source below).
  52.  
  53.   You may easily edit the macros to provide any substitutions you
  54.   want.  Strings as well as single characters may be substituted: the
  55.   string "integer" could be expanded from "i", or your name from your
  56.   initial.  Modify the language menu to provide character sets of your
  57.   choice - math, Greek, graphics, and so on.
  58.  
  59.   If you have occasional need for characters from different languages,
  60.   you might group them into a single International set rather than
  61.   switching languages.  The tradeoff would be that you'd have fewer
  62.   automatic substitutions and more menu choices.
  63.  
  64.   If a printable key such as <`> is chosen as the trigger for
  65.   mAccenter(), the Literal() command (assigned to <Ctrl P> in the
  66.   factory configuration of TSE) may be used whenever the character
  67.   itself is required in the text.
  68.  
  69.   Comments and improvements are welcome.
  70.  
  71. ********************************************************************/
  72.  
  73. // global variable:
  74. integer language = 1 // French is default
  75. // make it 3 and you have Spanish default
  76.  
  77. // LANGUAGE SELECTION ROUTINES:
  78.  
  79. menu langMenu()
  80.   history
  81.   "&French"  "&German"   "&Spanish"
  82.   "", , Divide  "&Currency"
  83. end
  84. proc mSelectLanguage()
  85.   langMenu()  language = MenuOption()
  86. end
  87.  
  88. // CHARACTER SUBSTITUTION ROUTINES:
  89.  
  90. proc sub(string newstring)
  91. // replaces current char by newstring, forcing insert.
  92.   DelChar()  InsertText(newstring,_insert_)
  93. end
  94.  
  95. menu FrenchAMenu()
  96.   "&Grave à", sub('à') "&Circ  â", sub('â')
  97. end
  98. menu FrenchEMenu()
  99.   "&Aigu   é", sub('é') "&Grave  è", sub('è') "&Circ   ê", sub('ê')
  100.   "&Umlaut ë", sub('ë')
  101.   end
  102. menu FrenchIMenu()
  103.   "&Circ   î", sub('î') "&Umlaut ï", sub('ï')
  104.   end
  105. menu FrenchUMenu()
  106.   "&Grave  ù" , sub('ù') "&Circ   û", sub('û')
  107. end
  108.  
  109. proc French()
  110.   case Chr(CurrChar())
  111.     when 'a' FrenchAMenu() when 'e' FrenchEMenu()
  112.     when 'i' FrenchIMenu() when 'u' FrenchUMenu()
  113.     when 'E' sub('É') when 'c' sub('ç') when 'C' sub('Ç')
  114.     when 'i' sub('î') when 'o' sub('ô')
  115.     otherwise Right() endcase
  116. end
  117. proc German()
  118.   case Chr(CurrChar())
  119.     when 'a' sub('ä') when 'A' sub('Ä') when 'o' sub('ö')
  120.     when 'O' sub('Ö') when 'u' sub('ü') when 'U' sub('Ü')
  121.     otherwise Right() endcase
  122. end
  123. proc Spanish()
  124.   case Chr(CurrChar())
  125.     when 'a' sub('á') when 'e' sub('é') when 'i' sub('í')
  126.     when 'o' sub('ó') when 'u' sub('ú') when 'n' sub('ñ')
  127.     when 'N' sub('Ñ')
  128.     when '?' sub('¿') when '/' sub('¿') // unshifted ? key
  129.     when '!' sub('¡') when '1' sub('¡') // unshifted ! key
  130.     otherwise Right() endcase
  131. end
  132. proc Currency()
  133.   case UpCase(Chr(CurrChar()))
  134.     when 'C' sub('¢') // cents
  135.     when 'L' sub('£') // pounds
  136.     when 'Y' sub('¥') // yen
  137.     otherwise Right() endcase
  138. end
  139.  
  140. proc mAccenter()
  141.   Left()
  142.   Case language
  143.     when 1 French() when 2 German() when 3 Spanish()
  144.     when 5 Currency()
  145.     endcase
  146. end
  147. <`> mAccenter()
  148. <Alt `> mSelectLanguage()
  149. /************************** End of macros **************************/
  150.